<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>提现审核管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript" src="${ctxStatic}/common/base-loading.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#checkAll").click(function () {
				$("input[name='id']:checkbox").prop("checked", this.checked);            
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
	//设置最终用户
	var setUpCardList = [];
	function examineBtn(){
		$("#contentTable .checkbox-hook:checked").each(function (){
			setUpCardList.push($(this).val());
		})
		if(setUpCardList.length == 0){
			$.jBox.tip('请至少选择一条数据进行审核。', 'error');
		}else{
			$.jBox.confirm("您确定审核操作吗？", "提示信息", submit, { buttons: { '通过': true, '不通过': false} });
		}
	}
		var submit = function (v, h, f) {
		    if (v == true)
		    	window.location.href = "${ctx}/orders/withdrawalsOrder/examine?ids="+setUpCardList.toString()+"&rechargeState="+2;
		    else
				//审核不通过
				window.location.href = "${ctx}/orders/withdrawalsOrder/examine?ids="+setUpCardList.toString()+"&rechargeState="+3;
		    return true;
		};
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/orders/withdrawalsOrder/withdrawalsExamineList">提现审核列表</a></li>
		<shiro:hasPermission name="orders:withdrawalsOrder:save"><li><a href="${ctx}/orders/withdrawalsOrder/openSave">提现添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="withdrawalsOrder" action="${ctx}/orders/withdrawalsOrder/withdrawalsExamineList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>提现订单号：</label>
				<form:input path="orderNo" htmlEscape="false" maxlength="20" class="input-medium"/>
			</li>
			<li class="btns">
				<a id="btnSubmit" class="btn btn-primary" onclick="return page();"><i class="icon-search"></i>&nbsp;查询</a>
			</li>
		</ul>
	</form:form>
	<div class="breadcrumb">
	  	<shiro:hasPermission name="orders:withdrawalsOrder:examine">
		  		<a type="button" onclick="examineBtn()" class="btn btn-warning" ><i class="icon-pencil"></i>&nbsp;批量审核</a>
	  	</shiro:hasPermission>
	</div>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><input type="checkbox" id="checkAll"/></th>
				<th>提现金额</th>
				<th>到账金额</th>
				<th>提现订单号</th>
				<th>提现状态 </th>
				<th>所属代理商</th>
				<th>备注信息</th>
				<th>创建时间</th>
			</tr>
		</thead>
		<tbody>
		<c:choose>
			<c:when test="${not empty page.list}">
				<c:forEach items="${page.list}" var="withdrawalsOrder">
					<tr>
						<td><input class="checkbox-hook" type="checkbox" name="id" value="${withdrawalsOrder.id}"/></td>
						<td>
							${withdrawalsOrder.withdrwalsAmount}
						</td>
						<td>
							${withdrawalsOrder.arrivalAmount}
						</td>
						<td>
							${withdrawalsOrder.orderNo}
						</td>
						<td>
							${fns:getDictLabel(withdrawalsOrder.state, 'w_state', '')}
						</td>
						<td>
							${withdrawalsOrder.officeName}
						</td>
						<td>
							${withdrawalsOrder.remarks}
						</td>
						<td>
							<fmt:formatDate value="${withdrawalsOrder.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
					</tr>
				</c:forEach>
			</c:when>
			<c:otherwise>
				<tr>
					<td colspan="8" style="text-align: center;font-size:17px; font-family:SimHei">未查询到数据...</td>
				</tr>
			</c:otherwise>
			</c:choose>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>